<template>
  <div class="center">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <i class="iconfont icon-tongji4" />
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">{{ title }}</span>
          <dv-decoration-3 class="dv-dec-3" />
        </div>
      </div>
      <div class="d-flex jc-center">
        <chart-pie :pie="pie" />
      </div>
      <!-- 4个主要的数据 -->
      <div class="bottom-data">
        <div
          class="item-box mt-2"
          v-for="(item, index) in digitals"
          :key="index"
        >
          <div class="d-flex jc-end">
            <i class="iconfont" :class="item.icon" />
            <dv-digital-flop class="dv-digital-flop" :config="item.config" />
          </div>
          <p>
            <span> {{ item.text }} </span>
            <span class="colorYellow">(人)</span>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import {defineComponent, toRefs} from 'vue'
import ChartPie from './draw'
export default defineComponent({
  props: {
    numerical: {
      type: Object,// 引用类型的话,默认值要为函数返回值的形式!!! 1.String 2.Number 3.Boolean 4.Array 5.Object 6.Date 7.Function 8.Symbol
      require: true
    },
  },
  components: {
    ChartPie
  },
  setup(props) {
    const { numerical } = toRefs(props)
    const  title = numerical.value.title
    const  digitals = numerical.value.digitals
    const  pie = numerical.value.pie
    return { title, digitals, pie}
  }
})
</script>

<style lang="scss" scoped>
.center {
  padding: 5px;
  border-radius: 10px;
  .bg-color-black {
    border-radius: 10px;
  }
  .text {
    color: #c3cbde;
  }
  .dv-dec-3 {
    position: relative;
    width: 100px;
    height: 20px;
    top: -3px;
  }

  .bottom-data {
    .item-box {
      & > div {
        padding-right: 5px;
      }
      font-size: 12px;
      float: right;
      position: relative;
      width: 50%;
      height: 45px;
      color: #d3d6dd;
      .dv-digital-flop {
        width: 150px;
        height: 20px;
      }
      i {
        font-size: 12px;
        line-height: 20px;
        margin-left: 20px;
      }
      .colorYellow {
        color: yellowgreen;
      }
      p {
        text-align: center;
      }
    }
    .mt-2{
      margin-top: 3px;
    }
  }
}
</style>
